package com.asj.vivo.lock.enums;

public enum WebSocketStateCode {
    WEB_SOCKET_EXCEPTION_CLOSE_BY_MIDDLE(5100,"与中台断开联系，尝试重新连接中！预计30秒内恢复"),
    WEB_SOCKET_EXCEPTION_CLOSE_BY_MDM(5100,"MDM_WebSocket服务器异常关闭！尝试重新连接中！预计30秒内恢复"),
    WEB_SOCKET_NORMAL_CONNECT(2100,"WebSocket已连接，可以通信"),
    WEB_SOCKET_PARAM_DEMAND_MISMATCH(5050,"WebSocket客户端需求与服务供应不匹配，请检查参数"),
    WEB_SOCKET_NORMAL_CLOSING(2501, "WebSocket连接正在关闭"),
    WEB_SOCKET_CLOSED_ABNORMALLY(5101, "WebSocket连接异常关闭，原因未知"),
    WEB_SOCKET_HANDSHAKE_FAILED(5102, "WebSocket握手失败，请检查URL或协议"),
    WEB_SOCKET_TIMEOUT(5103, "WebSocket连接超时，请检查网络连接"),
    WEB_SOCKET_PROTOCOL_ERROR(5104, "WebSocket协议错误，请检查发送的数据格式"),
    WEB_SOCKET_PAYLOAD_TOO_LARGE(5105, "WebSocket消息负载过大，超出服务器处理能力"),
    WEB_SOCKET_UNAUTHORIZED(5106, "WebSocket连接未授权，请提供正确的认证信息"),
    WEB_SOCKET_FORBIDDEN(5107, "WebSocket连接被禁止，没有足够的权限"),
    WEB_SOCKET_NOT_FOUND(5108, "WebSocket请求的资源未找到"),
    WEB_SOCKET_BAD_REQUEST(5109, "WebSocket请求错误，请检查请求参数"),
    WEB_SOCKET_INCOMPATIBLE(5110, "WebSocket客户端与服务器不兼容"),
    WEB_SOCKET_INTERNAL_SERVER_ERROR(5111, "WebSocket服务器内部错误，请退出重启尝试恢复连接"),
    WEB_SOCKET_SERVICE_UNAVAILABLE(5112, "WebSocket服务不可用，请稍后再试"),
    WEB_SOCKET_TOO_MANY_REQUESTS(5113, "WebSocket请求过于频繁，请稍后再试"),
    WEB_SOCKET_TLS_HANDSHAKE_FAILURE(5114, "WebSocket TLS握手失败，请检查TLS配置"),


    BIND_DEVICE_ERROR(5510,"设备绑定失败！请稍候重试或联系客服人员！")

    ;


    private final Integer code;
    private final String description;

    public Integer getCode() {
        return code;
    }
    public String getDescription() {
        return description;
    }
    WebSocketStateCode(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    // 根据枚举值获取状态码和描述信息的方法
    public static String getStateDescription(WebSocketStateCode stateCode) {
        return stateCode.getCode() + " - " + stateCode.getDescription();
    }
}
